<?xml version="1.0" encoding="utf-8" ?>
<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>欢迎来到校园二手交易系统</title>
<style type=text/css>
.title {
	background-image:
		url(${pageContext.request.contextPath }/img/title_background.gif);
}

.touxiang {
	background-image:
		url(${pageContext.request.contextPath }/img/touxiang.gif);
}

.label {
	text-align: center;
	font-family: 微软雅黑;
}

.loginbutton {
	text-align: center;
	font-family: "微软雅黑";
	vertical-align: middle;
}

body {
	background: url(${pageContext.request.contextPath }/img/bg.jpg) repeat-x;
}

a:link {
	text-decoration: none;
	color: #FFFFFF;
}

a:visited {
	text-decoration: none;
	color: #000000;
}

.adminlogin {
	align: right;
	color: #969696;
	text-decoration: none;
	font-family: "微软雅黑";
}

.warn {
	color: #FF0000;
	font-size: 12px;
	font-family: "微软雅黑";	
}
</style>
<script type="text/javascript">
	function check() {
		var jqueryObj1 = $("#usernum");
		var usernum = jqueryObj1.val();
		var jqueryObj2 = $("#password");
		var password = jqueryObj2.val();
		$.get("${pageContext.request.contextPath }/login.do?time="
				+ new Date().getTime() + "&usernum=" + usernum + "&password="
				+ password, null, checkback);
	}
	function checkback(data) {
		if (data.length == 6) {
			var resultObj = $("#result2");
			resultObj.html(data);
		} else {
			window.location.href = "${pageContext.request.contextPath }/view/index.jsp";
		}
	}
	function verify() {
		var jqueryObj = $("#usernum");
		var usernum = jqueryObj.val();
		$.get("${pageContext.request.contextPath }/LoginAjaxServlet?usernum="
				+ usernum, null, callback);
	}
	function callback(data) {
		var resultObj = $("#result1");
		resultObj.html(data);
	}
</script>
<script type="text/javascript"
	src="${pageContext.request.contextPath }/js/jquery-1.6.2.js"></script>
</head>
<body>
	<table width="600" border="0" align="center">
		<tr>
			<td width="93" rowspan="4"></td>
			<td width="400"></td>
			<td width="93" rowspan="4"></td>
		</tr>
		<tr>
			<td width="400" height="100" class="title"></td>
		</tr>
		<tr>
			<td width="400" height="400">
				<table width="400" border="0">
					<tr>
						<td height="200" colspan="3"><table width="100%" border="0">
								<tr>
									<td width="100" height="200"></td>
									<td width="200" height="200" class="touxiang"></td>
									<td width="100" height="200"></td>
								</tr>
							</table></td>
					</tr>
					<tr>
						<td width="100" class="label">学号：</td>
						<td width="200" height="30"><input type="text" name="usernum"
							id="usernum" style="width: 191px;" onblur="verify()" /></td>
						<td width="100"><span id="result1" class="warn"></span></td>
					</tr>
					<tr>
						<td width="100" class="label">密码：</td>
						<td width="200" height="30"><input type="password"
							name="password" id="password" style="width: 191px;" /></td>
						<td width="100"><span id="result2" class="warn"></span></td>
					</tr>
					<tr>
						<td width="100" height="30"></td>
						<td width="200" height="30"><div align="center">
								<input name="button" type="button" class="loginbutton"
									id="button" value="登录" onclick="check()" />
							</div></td>
						<td height="100"></td>
					</tr>
				</table>
			</td>
		</tr>
		<tr>
			<td height="55"></td>
		</tr>
	</table>

	<div class="adminlogin">
		<div align="right">
			<a href="${pageContext.request.contextPath }/admin/login.jsp">管理员登陆</a>
		</div>
	</div>
</body>
</html>